<?php
namespace Admin\Model;
use Think\Model;


class NewscateModel extends Model{

    public function getAll(){
        $list=$this->field(array('id','name','pid','create'))->select();
        return $list;
    }

    public function getpid(){
        $list=$this->select();
        $list=array_unique($list);
        return $list;
    }

    public function getname($id){
        $name=$this->where('id='.$id)->find()['name'];
        return $name;
    }

    public function finded($where){
        $list=$this->where($where)->find();
        return $list;
    }

    public function create($data){
        $res=$this->add($data);
        return $res;
    }

    public function update($where,$data){
        $res=$this->where($where)->save($data);
        return $res;
    }

    public function deleted($where){
        $res=$this->where($where)->delete();
        return $res;
    }

    public function findPath($where){

        $path=$this->where($where)->find()['path'];
        return $path;

    }




}